#include<iostream>
using namespace std;


#include"HashTable.h"
using namespace wh;

void test1()
{
	HashTable<int, int> ht;
	int a[] = { 4,14,24,34,5,7,1 };
	for (auto e : a)
	{
		ht.Insert(make_pair(e, e));
	}


	ht.Insert(make_pair(3, 3));
	ht.Insert(make_pair(-3, -3));
	ht.Insert(make_pair(100, 100));
	ht.Insert(make_pair(10, 10));
	ht.Insert(make_pair(99, 99));
	ht.Print();
	cout << ht.size() << endl;
}

void test2()
{
	string arr[] = { "㽶", "","ƻ", "", "ƻ", "", "ƻ", "ƻ", "", "ƻ", "㽶", "ƻ", "㽶" };
	//HashTable<string, int, HashFuncString> ht;
	HashTable<string, int> ht;
	for (auto& e : arr)
	{
		//auto ret = ht.Find(e);
		HashData<string, int>* ret = ht.Find(e);
		if (ret)
		{
			ret->_kv.second++;
		}
		else
		{
			ht.Insert(make_pair(e, 1));
		}
	}

	ht.Print();

	ht.Insert(make_pair("apple", 1));
	ht.Insert(make_pair("sort", 1));

	ht.Insert(make_pair("abc", 1));
	ht.Insert(make_pair("acb", 1));
	ht.Insert(make_pair("aad", 1));

	ht.Print();
}

int main()
{
	//test1();

	test2();
	return 0;
}